#!/usr/bin/env python

import getpass, poplib

M = poplib.POP3_SSL('pop.gmail.com')
M.user(raw_input('Login: '))
M.pass_(getpass.getpass())
numMessages = len(M.list()[1])
if numMessages == 0:
	print 'Voce nao tem novas mensagens'
else:
	print 'Voce tem', numMessages, 'mensagens novas e seus "Subjects" sao:'	
	for i in range(numMessages):
		for j in M.retr(i+1)[1]:
			if 'Subject' in j:
				print j
	


